#include<iostream>
#include<string>
#include<queue>
#include<unordered_map>

using namespace std;

int main(){
	int res=0;
	queue<char> q;
	unordered_map<char, bool> map;
	string s;
	cin>>s;
	for(char c:s){
		while(map.count(c)){
			map.erase(q.front());
			q.pop();
		}
		q.push(c);
		map[c] = true;
		if (q.size()>res) res = q.size();
	}
	cout<<res;
	return 0;
} 
